-
Notifications
You must be signed in to change notification settings - Fork 171
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
using secp256k1-node v3.0.0 #60
base: master
Are you sure you want to change the base?
Conversation
920ac8b
to
48e8e69
Compare
Updated! |
Interesting that |
@fanatid I was looking at this last night in attempt to get bitauth updated to v3.2.2 of the bindings. Most of it looks pretty good, but there is one problem. secp256k1-node now returns false when verifying signatures with high s values. This is a problem for us. The bitauth spec does not require the strict signature style found in BIP0062. We have BitPay api clients in a number of different languages. I looked at a few, (C#, ruby, php), and they don't do any kind of s value checking. If we started verifying signatures with the new bindings, lots of api requests to bitpay.com would fail signature validation. Is it possible to add an additional api to the bindings to do non-strict signature verification? I would prefer not to have to normalize all signatures in order to verify them. As I understand it, we would also want to use |
@gabegattis it is possible add additional api method, but I do not want to do this, because bitcoin-core/secp256k1 doesn't have this and as result I will have to make something that did with ecdh. So answer is no, we should use |
Ok. I will guess I will need to do some testing with normalization. Do you have any concept of the computational cost for normalizing/verifying a signature compared to just verifying an already-normalized sig? I will make some benchmarks at some point. |
@gabegattis normalize is very-very fast: const bindings = require('./bindings')
const priv = Buffer.from('c26848a3a9b8c60ba6757d6e3c8baa0a0ded80887510b4eebc0980db74415684', 'hex')
const pub = bindings.publicKeyCreate(priv)
const msg = Buffer.from('3dc81fd01b4b8b23e1c92cb461b5752d76bad4d990b9f4d591ff7fc77d4b8419', 'hex')
const sig = bindings.sign(msg, priv).signature
console.time('verify')
for (let i = 0; i < 10000; ++i) { bindings.verify(msg, sig, pub) }
console.timeEnd('verify')
console.time('normialize')
for (let i = 0; i < 10000; ++i) { bindings.signatureNormalize(sig) }
console.timeEnd('normialize') on my machine:
verify -- ~5000 ops/s |
That is good news then. I just tried my own benchmark as well, but using a high s value sig. I got similar results. Normalizing is about 100 times faster than verifying. |
Some optimizations with secp256k1-node v3.0.0 (hope will be available soon).
verifySignature
andvalidateSin
callback pattern. Why not just throw error or return boolean? All operations are synchronous.